package com.kzhkwkt.sugoieditor;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class TitleEdit extends Activity {

	EditText titleText = null;
	public static final String TITLE_KEY = "TITLE_KEY";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.title_edit);
		setTitle(getString(R.string.label_title_edit));

		titleText = (EditText)findViewById(R.id.title_edit_text);
	}

	public void submit(View v) {
		if(titleText.getText().length() == 0) {
			return;
		}

		Intent intent = new Intent();
		intent.putExtra(TITLE_KEY, titleText.getText().toString());
		setResult(C.ResponseCode.EDIT_TITLE, intent);
		finish();
	}

	public void cancel(View v) {
		finish();
	}
}
